Build target to wrap dist/install in a .deb archive.
authorTim Deegan <Tim.Deegan@citrix.com>
Mon, 16 May 2011 12:34:25 +0000 (13:34 +0100)
committerTim Deegan <Tim.Deegan@citrix.com>
Mon, 16 May 2011 12:34:25 +0000 (13:34 +0100)
Adds "make deb", which does a "make dist" build and wraps the
resulting dist/install files in dist/xen-<version>.deb

This is _not_ a "packaged" version of Xen for Debian users, nor is it
intended to compete with anyone else's packaging efforts.  In
particular it doesn't do any of the boot-time or fstab fixups needed
to actually start the xen tools.  It's just a quick hack for
developers to be able to quickly install and uninstall a Xen build on
a test box.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Makefile
tools/misc/mkdeb [new file with mode: 0644]
xen/Makefile

index 662e31f549d1135c7812e71629bef5bc31042a04..9f1e3c4af1e556f225fa7d1610399aead1eac1ff 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -118,6 +118,11 @@ world:
        $(MAKE) kdelete
        $(MAKE) dist
 
+# Package a build in a .deb file
+.PHONY: deb
+deb: dist
+       fakeroot sh ./tools/misc/mkdeb $(XEN_ROOT) $$($(MAKE) -C xen xenversion | grep -v :)
+
 # clean doesn't do a kclean
 .PHONY: clean
 clean::
diff --git a/tools/misc/mkdeb b/tools/misc/mkdeb
new file mode 100644 (file)
index 0000000..603cd6b
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# mkdeb: package the dist/install output of a Xen build in a .deb 
+#
+# Takes 2 arguments, the path to the dist directory and the version
+
+set -e
+
+if test -z "$1" -o -z "$2" ; then 
+  echo "usage: $0 path-to-XEN_ROOT xen-version"
+  exit 1
+fi 
+
+cd $1
+version=$2
+if test "$XEN_TARGET_ARCH" = "x86_32"; then
+  arch=i386
+else
+  arch=amd64
+fi
+
+# Prepare the directory to package
+cd dist
+rm -rf deb
+cp -a install deb
+
+# Debian doesn't use /usr/lib64 for 64-bit libraries
+if test -d deb/usr/lib64 ; then 
+  cp -a deb/usr/lib64/* deb/usr/lib/
+  rm -rf deb/usr/lib64
+fi
+
+# Fill in the debian boilerplate
+mkdir -p deb/DEBIAN
+cat >deb/DEBIAN/control <<EOF
+Package: xen-upstream-$version
+Source: xen-upstream
+Version: $version
+Architecture: $arch
+Maintainer: Unmaintained snapshot
+Section: admin
+Priority: optional
+Installed-Size: $(du -ks deb | cut -f1)
+Description: Xen hypervisor and tools, version $version
+ This package contains the Xen hypervisor and associated tools, built
+ from a source tree.  It is not a fully packaged and supported Xen, just
+ the output of a xen "make dist" wrapped in a .deb to make it easy to
+ uninstall.
+EOF
+
+# Package it up
+chown -R root:root deb
+dpkg --build deb $xen-upstream-$version.deb
+
+# Tidy up after ourselves
+rm -rf deb
index dcaab5cbf2e680d8ccd403e6892e879ecf32a2ef..19ada7ef540bbbc212b7dd1a0db7a61410fd3d8f 100644 (file)
@@ -129,6 +129,10 @@ define set_exuberant_flags
            --extra=+f --c-kinds=+px") || true` 
 endef
 
+.PHONY: xenversion
+xenversion:
+       @echo $(XEN_FULLVERSION)
+
 .PHONY: _TAGS
 _TAGS: 
        set -e; rm -f TAGS; \